import Vue from 'vue'
import iView from 'iview'
import VueRouter from 'vue-router'
import Routers from './router'
import Util from './libs/util'
import App from './app.vue'
import 'iview/dist/styles/iview.css'

Vue.use(VueRouter)

Vue.use(iView)
//moment
import moment from 'moment'//导入文件
Vue.prototype.$moment = moment;//赋值使用

// 步骤条
import StepBar from './components/StepBar'
Vue.component('StepBar', StepBar)

// 我的审核 table 栏
import MyTrialTab from './components/MyTrialTab'
Vue.component('MyTrialTab', MyTrialTab)

// 上传
import UploadFile from './components/UploadFile'
Vue.component('UploadFile', UploadFile)

//旧的名字
import Oldname from './components/Oldname'
Vue.component('Oldname', Oldname)

//打印
import PrintButton from './components/Print'
Vue.component('PrintButton', PrintButton)

//查看按钮
import ButtonShow from './components/ButtonShow'
Vue.component('ButtonShow', ButtonShow)

// 谷歌地图
import * as VueGoogleMaps from 'vue2-google-maps'
Vue.use(VueGoogleMaps, {
    load: {
        // key: 'AIzaSyCDoZwHDtJ0GKx-U9Y-SZwgL_5vNDeDBKs'
        key: 'AIzaSyBMax06DjAJoHnTK1HBZNLh3GBxBETJ7Vw',
        libraries: 'places',
        loadCn: true
    }
})

import axios from './libs/axios'
window.axios = axios

// 数组扩展
import './libs/array'

// 路由配置
const RouterConfig = {
    mode: 'history',
    routes: Routers
}
const router = new VueRouter(RouterConfig)

router.beforeEach((to, from, next) => {
    iView.LoadingBar.start()
    Util.title(to.meta.title)
    next()
})

router.afterEach(() => {
    iView.LoadingBar.finish()
    window.scrollTo(0, 0)
})

// vuex
import store from './store'

new Vue({
    el: '#app',
    router,
    store,
    render: h => h(App)
})
